package com.ruoyi.busi.guide.controller;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.web.core.BaseController;
import com.ruoyi.common.core.core.domain.R;
import com.ruoyi.busi.guide.domain.Student;
import com.ruoyi.busi.guide.service.IStudentService;

/**
 * 学生信息Controller
 */
@RestController
@RequestMapping("/busi/guide/student")
public class StudentController extends BaseController {
    @Autowired
    private IStudentService studentService;

    /**
     * 根据导师ID获取学生列表
     */
    @GetMapping("/mentor/{mentorId}")
    public R<List<Student>> listByMentorId(@PathVariable Long mentorId) {
        return R.ok(studentService.selectByMentorId(mentorId));
    }

    /**
     * 新增学生
     */
    @PostMapping
    public R<Boolean> add(@RequestBody Student student) {
        return R.ok(studentService.save(student));
    }

    /**
     * 修改学生
     */
    @PutMapping
    public R<Boolean> edit(@RequestBody Student student) {
        return R.ok(studentService.updateById(student));
    }

    /**
     * 删除学生
     */
    @DeleteMapping("/{studentIds}")
    public R<Boolean> remove(@PathVariable List<Long> studentIds) {
        return R.ok(studentService.deleteStudentByIds(studentIds));
    }
}
